package com.example.elasticsearchdemo.pojo;

import org.elasticsearch.index.query.MultiMatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.ArrayList;
import java.util.List;


/*
    indexNam:索引库名称(数据库)
    type:类型 (表)
    shards:默认分区数
    replicas:默认备份数
    refreshInterval:刷新时间间隔
    indexStoreType:索引文件存储类型
 */
@Document(indexName = "vojena")
public class Entry {

    @Id
    private String id;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String content;

    //对对象字段的注解
    @Field(type = FieldType.Object)
    private A a;


    public void setA(A a) {
        this.a = a;
    }

    public A getA() {
        return a;
    }

    public static Entry create(String title, String content) {
        Entry entry = new Entry();
        entry.setTitle(title);
        entry.setContent(content);
        return entry;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public String getTitle() {
        return title;
    }

}
